package jp.co.menox.tmcommon.model;

import java.io.Serializable;
import java.util.Date;

import com.google.appengine.api.datastore.Key;

import org.slim3.datastore.Attribute;
import org.slim3.datastore.Model;

/**
 * 貸し借り履歴
 * @author
 *
 */
@Model(schemaVersion = 1)
public class LendingHistory extends CommonModelBase implements Serializable {

    private static final long serialVersionUID = 1L;

    @Attribute(primaryKey = true)
    private Key key;

    @Attribute(version = true)
    private Long version;

    /**
     * Returns the key.
     *
     * @return the key
     */
    public Key getKey() {
        return key;
    }

    /**
     * Sets the key.
     *
     * @param key
     *            the key
     */
    public void setKey(Key key) {
        this.key = key;
    }

    /**
     * Returns the version.
     *
     * @return the version
     */
    public Long getVersion() {
        return version;
    }

    /**
     * Sets the version.
     *
     * @param version
     *            the version
     */
    public void setVersion(Long version) {
        this.version = version;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((key == null) ? 0 : key.hashCode());
        return result;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        LendingHistory other = (LendingHistory) obj;
        if (key == null) {
            if (other.key != null) {
                return false;
            }
        } else if (!key.equals(other.key)) {
            return false;
        }
        return true;
    }

    // **** 固有項目

    /** 貸したいものID */
    private long lendingId;
    /** 貸与者ID */
    private long lendingUser;
    /** 借用者ID */
    private long borrowingUser;
    /** 個数 */
    private int count;
    /** 貸し出し期間（開始日） */
    private Date fromDate;
    /** 貸し出し期間（終了日） */
    private Date toDate;
    /** ステータス */
    private int statusType;
    /** 申請日（予約日） */
    private Date requestDate;
    /** 承認日 */
    private Date approvalDate;
    /** 貸出日 */
    private Date lentDate;
    /** 返却予定日 */
    private Date returnPlanDate;
    /** 返却日 */
    private Date returnedDate;
    /** 申請却下日 */
    private Date rejectedDate;
    /** キャンセル日 */
    private Date cancelDate;
    /** キャンセルユーザ */
    private long cancelUser;
    /** シェアリングID */
    private String sharingId;

    // **** アクセッサ：固有項目
    
    public long getLendingId() {
        return lendingId;
    }
    public void setLendingId(long lendingId) {
        this.lendingId = lendingId;
    }

    public long getLendingUser() {
        return lendingUser;
    }
    public void setLendingUser(long lendingUser) {
        this.lendingUser = lendingUser;
    }

    public long getBorrowingUser() {
        return borrowingUser;
    }
    public void setBorrowingUser(long borrowingUser) {
        this.borrowingUser = borrowingUser;
    }

    public int getCount() {
        return count;
    }
    public void setCount(int count) {
        this.count = count;
    }

    public Date getFromDate() {
        return fromDate;
    }
    public void setFromDate(Date fromDate) {
        this.fromDate = fromDate;
    }

    public Date getToDate() {
        return toDate;
    }
    public void setToDate(Date toDate) {
        this.toDate = toDate;
    }

    public int getStatusType() {
        return statusType;
    }
    public void setStatusType(int statusType) {
        this.statusType = statusType;
    }

    public Date getRequestDate() {
        return requestDate;
    }
    public void setRequestDate(Date requestDate) {
        this.requestDate = requestDate;
    }

    public Date getApprovalDate() {
        return approvalDate;
    }
    public void setApprovalDate(Date approvalDate) {
        this.approvalDate = approvalDate;
    }

    public Date getLentDate() {
        return lentDate;
    }
    public void setLentDate(Date lentDate) {
        this.lentDate = lentDate;
    }

    public Date getReturnPlanDate() {
        return returnPlanDate;
    }
    public void setReturnPlanDate(Date returnPlanDate) {
        this.returnPlanDate = returnPlanDate;
    }

    public Date getReturnedDate() {
        return returnedDate;
    }
    public void setReturnedDate(Date returnedDate) {
        this.returnedDate = returnedDate;
    }

    public Date getRejectedDate() {
        return rejectedDate;
    }
    public void setRejectedDate(Date rejectedDate) {
        this.rejectedDate = rejectedDate;
    }

    public Date getCancelDate() {
        return cancelDate;
    }
    public void setCancelDate(Date cancelDate) {
        this.cancelDate = cancelDate;
    }

    public long getCancelUser() {
        return cancelUser;
    }
    public void setCancelUser(long cancelUser) {
        this.cancelUser = cancelUser;
    }

    public String getSharingId() {
        return sharingId;
    }
    public void setSharingId(String sharingId) {
        this.sharingId = sharingId;
    }
    
}
